package posti.test.swf.dao.queries.book;

import java.util.Arrays;

import posti.test.domain.Book;
import ar.posti.framework.query.core.Filter;
import ar.posti.framework.query.core.QuerySupport;
import ar.posti.framework.query.core.filter.criteria.Equals;
import ar.posti.framework.query.hibernate.filter.From;
import ar.posti.framework.query.hibernate.filter.Where;

public class BooksQuery extends QuerySupport {
	public BooksQuery() {
		Filter[] filters = new Filter[] {
			new From(Book.class),
			new Where
				(new Equals("title", ":title")).and
				(new Equals("isbn", ":isbn")).and
				(new Equals("review.text", ":review_text"))
		};

		this.compose(Arrays.asList(filters));
	}

	public void setTitle(String title) { 
		this.bindVariable("title", title);
	}
	
	public void setReviewText(String text) {
		this.bindVariable("review_text", text);
	}
	
	public void setIsbn(String isbn) {
		this.bindVariable("isbn", isbn);
	}
}
